# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : full_discounts_apis.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2023/8/22 21:20
# @Copyright: 北京码同学
from api.base_api import BaseSellerApi


class AddFullDiscountsApi(BaseSellerApi):
    """
    添加满减满赠活动
    """
    def __init__(self,start_time,end_time):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/full-discounts'
        self.method = 'post'
        self.json = {
            "title": "沙陌20230530班",
            "take_effect_time": [
                start_time*1000,
                end_time*1000
            ],
            "description": "<p>SDDDDD</p>",
            "full_money": "100", # 优惠门槛
            "is_discount": 0,
            "discount_value": "",
            "is_full_minus": 0,
            "minus_value": "",
            "isIntegral": 0,
            "integral": 0,
            "is_free_ship": 0,
            "is_send_gift": 0,
            "gift_id": "",
            "is_send_bonus": 0,
            "bonus_id": "",
            "range_type": 1,
            "is_send_point": 0,
            "point_value": None,
            "start_time": start_time,
            "end_time": end_time
        }

class ChangeFullDiscountsApi(BaseSellerApi):
    """
    添加满减满赠活动
    """
    def __init__(self,id,start_time,end_time):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/full-discounts/{id}'
        self.method = 'put'
        self.json = {
            "title": "沙陌20230530班",
            "take_effect_time": [
                start_time*1000,
                end_time*1000
            ],
            "description": "<p>SDDDDD</p>",
            "full_money": "100", # 优惠门槛
            "is_discount": 0,
            "discount_value": "",
            "is_full_minus": 0,
            "minus_value": "",
            "isIntegral": 0,
            "integral": 0,
            "is_free_ship": 0,
            "is_send_gift": 0,
            "gift_id": "",
            "is_send_bonus": 0,
            "bonus_id": "",
            "range_type": 1,
            "is_send_point": 0,
            "point_value": None,
            "start_time": start_time,
            "end_time": end_time
        }
class GetFullDiscountsByIdApi(BaseSellerApi):
    """
    查询满减满赠活动
    """
    def __init__(self,id):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/full-discounts/{id}'
        self.method = 'get'
class DeleteFullDiscountsByIdApi(BaseSellerApi):
    """
    查询满减满赠活动
    """
    def __init__(self,id):
        super().__init__()
        self.url = f'{self.host}/seller/promotion/full-discounts/{id}'
        self.method = 'delete'